package com.zerosky.crm.util;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * @author Engineer-Jsp
 * @date 2014.09.23
 * 参数API类*/
public class ParamesAPI {
	
	public ParamesAPI()
	{
		Properties pps = System.getProperties();
		 try {
			 //String path = new File("").getAbsolutePath()+"/system.properties";
			 
			 String paths = ParamesAPI.class.getClassLoader().getResource("").getPath()+"/system.properties";
			 File file=new File(paths);

			 pps.load(new FileInputStream(file));
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		 //System.out.println(pps.toString());
		 
		 token =  pps.getProperty("WeXingToken");
		 corpId =  pps.getProperty("WeXingCorpId");
		 secret =  pps.getProperty("WeXingSecret");
		 REDIRECT_URI =  pps.getProperty("WeXingREDIRECT_URI");
		 AGENT_ID =  pps.getProperty("WeXingAGENT_ID");
		 pwd =  pps.getProperty("pwd");//通用密码
		 
		 //System.out.println(corpId);
	}
	
	// token
	public static String token = "WeiXinEnterprises";  
	//共用密码
	public static String pwd = "996543"; 
	// 随机戳
	//public static String encodingAESKey = "tw8ColhrtDzU6XTHJ2shUeTyuaPQkSzdvD8jYtnTIYf";  
	 //你的企业号ID
	public static String corpId = "wx0d5a21239b276648";
	// 管理组的凭证密钥，每个secret代表了对应用、通讯录、接口的不同权限；不同的管理组拥有不同的secret
	//TEST
	//public static String secret = "wyBenwakts69JIihWe7jg9EKhLS2dzxsNEoCv6NbTMk";
	//客户管理
	public static String secret = "hswFnfpfiG-i42vh0j8cTZc2-wkCsnlYcATQbDrJRKQ";
	// OAuth2 回调地址
	//public static String REDIRECT_URI = "http://vm2q3mn.hn3.mofasuidao.cn/FUNDCRM/weixin/verification.do";
	public static String REDIRECT_URI = "http://crm.jiagengyuan.com/weixin/verification.do";
	
	
	
	//应用APPID
	//public static String AGENT_ID = "1000002";
	public static String AGENT_ID = "1000003";
	public static void main(String[] args) throws IOException {
		//File f = new File(ParamesAPI.class.getResource("/").getPath()); 
		File f = new File("");
		System.out.println(f.getCanonicalPath() );
		 InputStream stm=ParamesAPI.class.getResourceAsStream("/system.properteis");
		 System.out.println(stm);
		 
		 Properties pps = System.getProperties();
		 pps.load(new FileInputStream(new File("").getAbsolutePath()+"/system.properties"));
		 System.out.println(pps.toString());
		 
		 token =  pps.getProperty("WeXingToken");
		 corpId =  pps.getProperty("WeXingCorpId");
		 secret =  pps.getProperty("WeXingSecret");
		 REDIRECT_URI =  pps.getProperty("WeXingREDIRECT_URI");
		 AGENT_ID =  pps.getProperty("WeXingAGENT_ID");
		 
		 System.out.println(corpId);
	}
}
